﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using LogManager.Base;
using Raven;
using Raven.Client;
using Raven.Client.Connection;
using Raven.Client.Connection.Async;
using Raven.Client.Linq;

namespace LogManager.LocalStorage.Data
{
    public class CustomRavenDbQueryable : RavenQueryInspector<Event>
    {
        public CustomRavenDbQueryable(IRavenQueryProvider provider, RavenQueryStatistics queryStats, string indexName, Expression expression, IDatabaseCommands databaseCommands, IAsyncDatabaseCommands asyncDatabaseCommands) : base(provider, queryStats, indexName, expression, databaseCommands, asyncDatabaseCommands)
        {
        }

        public int Count()
        {
            RavenQueryStatistics statistics;
            Statistics(out statistics);
            return statistics.TotalResults;
        }
    }
}
